 <?php echo $this->session->flashdata('message'); ?>    
    <div class="column half fl">
		
		<div class="box themed_box">
		<h2 class="box-header"><?php echo $this->lang->line('this_weekly'); ?></h2>

		<div class="box-content box-table ">
        
		 
		 <table class="tablebox">
		<thead class="table-header">
		<tr>
			<th><?php echo $this->lang->line('date'); ?></th>
            <th><?php echo $this->lang->line('customer_name'); ?></th>
            <th>Action</th>
		</tr>
		</thead>
		<tbody>
            
			<?php foreach($table['details'] as $rec):  ?>
            <form id="formtest" name="formtest" method="post" action="<?php echo site_url($form['action_update']); ?>">
            <input type="hidden" name="id" value="<?php echo $rec['id']; ?>" />
            <tr class="odd">
				<td>
                    <input name="date1" class="form-field datepicker width100" type="text" value="<?php echo $rec['activity_date']; ?>" />        
                </td>
                <td>
                    <select class="form-field width100" name="customer" >
                       <option value="<?php echo $rec['customer_id']; ?>"><?php echo $rec['customer_name'].'-'.$rec['rev']; ?></option>
                       <?php foreach($table['customers'] as $cust): ?>
                        <option value="<?php echo $cust['id']; ?>"><?php echo $cust['customer_name'].' - '.$cust['rev']; ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
				
                <td>
                    
				    <button class="button white" name="save" type="submit"><span class="icon_single save"></span></button>
					<a class="button white" href="<?php echo site_url($this->config->item('actvtarget_delete').$rec['id']); ?>"><span class="icon_single cancel"></span></a>
                </td>
			</tr>
            </form>	
            <?php endforeach; ?>
            
            <form id="formtest" name="formtest" method="post" action="<?php echo site_url($form['action']); ?>">
            <?php for($i=0;$i<8;$i++): ?>
            <tr class="even">
				<td class="tc width30">
                    <input name="date1[]" class="form-field datepicker width100" type="text" value="<?php if($table['value']<>"") { echo $table['value']['date_out']; } ?>" />        
                </td>
                <td class="tc width55">
                    <select name="customer1[]" class="form-field width100">
                       <option value="">Select a Customer</option> 
                       <?php foreach($table['customers'] as $cust): ?>
                        <option value="<?php echo $cust['id']; ?>"><?php echo $cust['customer_name'].' - '.$cust['rev'].' <-> '.$cust['rev2']; ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
				
                <td class="tc width15">
                    <!--<button class="button white" name="save" type="submit"><span class="icon_single save"></span></button>
                    -->
                </td>    
			</tr>
            <?php endfor;?>
            
            
            
			
		</tbody>
        <tfoot class="table-header">
		<tr>
			<th></th>
            <th><input id="validate" class="button themed" type="submit" value="<?php echo $this->lang->line('save');?>" name="save" /></th>
            <th></th>
		</tr>
		</tfoot>
        </form>	
            
			
		</tbody>
		</table>
		 
        </div>
		<div class="clear"></div>
        </div>
    </div>
    
    <div class="column half fr">
		
		<div class="box themed_box">
		<h2 class="box-header"><?php echo $this->lang->line('next_weekly'); ?></h2>

		<div class="box-content box-table ">
			
			<?php //echo $this->session->flashdata('message11'); ?>
		
        <form id="formtest" name="formtest" method="post" action="<?php echo site_url($form['action']); ?>">
        <table class="tablebox">
		<thead class="table-header">
		<tr>
			<th><?php echo $this->lang->line('date'); ?></th>
            <th><?php echo $this->lang->line('customer_name'); ?></th>
            <th>Action</th>
		</tr>
		</thead>
		<tbody>
			<?php foreach($table['nextdetails'] as $rec):  ?>
            <form id="formtest" name="formtest" method="post" action="<?php echo site_url($form['action_update']); ?>">
            <input type="hidden" name="id" value="<?php echo $rec['id']; ?>" />
            <tr class="odd">
				<td class="tc width30">
                    <input name="date" class="form-field datepicker width100" type="text" value="<?php echo $rec['activity_date']; ?>" />        
                </td>
                <td class="tc width65" >
                    <select class="form-field width100" name="customer">
                       <option value="<?php echo $rec['customer_id']; ?>"><?php echo $rec['customer_name'].'-'.$rec['rev']; ?></option>
                       <?php foreach($table['customers'] as $cust): ?>
                        <option value="<?php echo $cust['id']; ?>"><?php echo $cust['customer_name'].' - '.$cust['rev']; ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
				
                <td class="tc width5">
                    
				    <button class="button white" name="save" type="submit"><span class="icon_single save"></span></button>
                    
					<a class="button white" href="<?php echo site_url($this->config->item('actvtarget_delete').$rec['id']); ?>"><span class="icon_single cancel"></span></a>
                </td>
			</tr>
            </form>			
            <?php endforeach; ?>
			
            <form id="formtest" name="formtest" method="post" action="<?php echo site_url($form['action']); ?>">
            <?php for($i=0;$i<8;$i++): ?>
            <tr class="even">
				<td class="tc width30">
                    <input name="date2[]" class="form-field datepicker width100" type="text" value="<?php if($table['value']<>"") { echo $table['value']['date_out']; } ?>" />        
                </td>
                <td class="width60">
                    <select class="form-field width100" name="customer2[]">
                       <option value="" selected="selected"><?php echo $this->lang->line('psc'); ?></option> 
                       <?php foreach($table['customers'] as $cust): ?>
                        <option value="<?php echo $cust['id']; ?>"><?php echo $cust['customer_name']; ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
			
                <td class="width5">
                    <!--<button class="button white" name="save" type="submit"><span class="icon_single save"></span></button>
                    -->
                </td>  
			</tr>
            <?php endfor;?>
            
   
		</tbody>
        
        <tfoot class="table-header">
		<tr>
			<th></th>
            <th><input id="validate" class="button themed" type="submit" value="<?php echo $this->lang->line('save');?>" name="save" /></th>
            <th></th>
		</tr>
		</tfoot>
        
		</table>
        </form>
            		
			
		</tbody>
		</table>
        </form>
			
        </div>
		<div class="clear"></div>
        </div>
    </div>	
	
	
	<div class="column full fl">
		
		<div class="box themed_box">
		<h2 class="box-header"><?php echo $this->lang->line('form_weekly'); ?></h2>

		<div class="box-content box-table ">
        <?php // echo $this->session->flashdata('message'); ?>
		
        
            
        <table class="tablebox">
		<thead class="table-header">
		<tr>
            <th><?php echo 'Call'; ?></th>
            <th><?php echo 'Call R'; ?></th>
            <th><?php echo 'Presetion'; ?></th>
            <th><?php echo 'Meeting'; ?></th>
            <th><?php echo 'D.Claim'; ?></th>
		</tr>
		</thead>
		<tbody>
            <tr class="even">
                    <td><input class="form-field width100 right" type="text" value="<?php echo $table['weekly']['call1']; ?>" name="activity[]" /></td>
                    <td><input class="form-field width100 right" type="text" value="<?php echo $table['weekly']['call_result']; ?>" name="activity[]" /></td>
                    <td><input class="form-field width100 right" type="text" value="<?php echo $table['weekly']['presentation']; ?>" name="activity[]" /></td>
                    <td><input class="form-field width100 right" type="text" value="<?php echo $table['weekly']['meeting']; ?>" name="activity[]" /></td>
                    <td><input class="form-field width100 right" type="text" value="<?php echo $table['weekly']['damage_claim']; ?>" name="activity[]" /></td>
			</tr>
		</tbody>
		</table>
            
            
		</div>
        <div class="clear"></div>
		</div>	
       	
        
			
	</div>

<?php if(($this->session->userdata('user_group')==$this->config->item('user')) || ($this->session->userdata('user_group')==$this->config->item('admin')) ): ?>	
   <div class="column full fl">
        
        <div class="box themed_box">
		<h2 class="box-header"><?php echo $this->lang->line('sales_fail'); ?></h2>

		<div class="box-content box-table">
        <?php echo $this->session->flashdata('message10'); ?>
		    
		   <table class="tablebox">
		<thead class="table-header">
		<tr>
			<th><?php echo $this->lang->line('date_in'); ?></th>
			<th><?php echo $this->lang->line('date_out'); ?></th>
            <th><?php echo $this->lang->line('customer_name'); ?></th>
			<th><?php echo $this->lang->line('type'); ?></th>
			<th><?php echo $this->lang->line('product_name'); ?></th>
			<th><?php echo $this->lang->line('note'); ?></th>
            <th>Action</th>
		</tr>
		</thead>
		<tbody>
            
			<?php foreach($table['sales'] as $rec):  ?>
            <form id="formtest" name="formtest" method="post" action="<?php echo site_url($form['action_update']); ?>">
            <input type="hidden" name="id" value="<?php echo $rec['id']; ?>" />
            <tr class="odd">
				<td class="tc width13">
                    <input name="datein" class="form-field datepicker width100" type="text" value="<?php echo $rec['date_in']; ?>" />        
                </td>
				<td class="tc width13">
                    <input name="dateout" class="form-field datepicker width100" type="text" value="<?php echo $rec['date_out']; ?>" />        
                </td>
                <td >
                    <select class="form-field width80" name="customer" >
                       <option value="<?php echo $rec['cust_id']; ?>"><?php echo $rec['customer_name']; ?></option>
                       <?php foreach($table['customers'] as $cust): ?>
                        <option value="<?php echo $cust['id']; ?>"><?php echo $cust['customer_name'].' - '.$cust['rev']; ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
				<td>
				 <select   class="form-field width100" id="select" name="status" title="Select a category">
                    <option value="<?php echo $rec['status']; ?>"><?php echo $rec['status']; ?></option>
                    <option value="F" >F</option>
                    <option value="P">P</option>
				</select>
				</td>
				
				<td>
				    <select class="form-field width100" name="customer" >
                       <option value="<?php echo $rec['prod_id']; ?>"><?php echo $rec['product_name'].'-'.$rec['product_time'].'-'.$rec['invest']; ?></option>
                       <?php foreach($table['products'] as $prod): ?>
                        <option value="<?php echo $prod['id']; ?>"><?php echo $prod['product_name'].'-'.$prod['product_time'].'-'.$prod['invest']; ?></option>
                        <?php endforeach; ?>
                    </select>	
				</td>
				
				<td>
                    <input name="desc" value="<?php echo $rec['note']; ?>" class="form-field width100" type="text"  />        
                </td>
				
                <td>
				    <!--<button class="button white" name="save" type="submit"><span class="icon_single save"></span></button>-->
                    <a class="button white" href="<?php echo site_url('activity/crm/deletefailed/'.$rec['id']); ?>"><span class="icon_single cancel"></span></a>
                </td>
			</tr>
            </form>	
            <?php endforeach; ?>
            
            <form id="formtest3" name="formtest3" method="post" action="<?php echo site_url($form['action2']); ?>">
            <?php for($i=0;$i<=5;$i++): ?>
            <tr class="even">
				<td class="tc width13">
                    <input name="datein[]" class="form-field datepicker width100" type="text" value="<?php if($table['value']<>"") { echo $table['value']['date_out']; } ?>" />        
                </td>
				
				<td class="tc width13">
                    <input name="dateout[]" class="form-field datepicker width100" type="text" value="<?php if($table['value']<>"") { echo $table['value']['date_out']; } ?>" />        
                </td>
                <td >
                    <select name="customer[]" class="form-field width80">
                       <?php foreach($table['customers'] as $cust): ?>
                        <option value="<?php echo $cust['id']; ?>"><?php echo $cust['customer_name'].' - '.$cust['rev']; ?></option>
                        <?php endforeach; ?>
                    </select>
                </td>
				
				<td>
				  <select class="form-field width100" id="select" name="status[]" title="Select a category">
                    <option value="F">F</option>
                    <option value="P">P</option>
				</select>
				</td>
				
				<td>
				    <select class="form-field width100" name="product[]" >
 
                       <?php foreach($table['products'] as $prod): ?>
                        <option value="<?php echo $prod['id']; ?>"><?php echo $prod['product_name'].'-'.$prod['product_time'].'-'.$prod['invest']; ?></option>
                        <?php endforeach; ?>
                    </select>	
				</td>
				
				<td>
                    <input name="desc[]" class="form-field width100" type="text"  />        
                </td>
				
                <td>
                    <!--
                    <button class="button white" name="save" type="submit"><span class="icon_single save"></span></button>
                    -->
                </td>    
			</tr>
            <?php endfor;?>
            <tr>
			<td></td>
			<td></td>
            <td></td>
			<td></td>
			<td><input id="validate" class="button themed" type="submit" value="<?php echo $this->lang->line('save');?>" name="save" /></td>
			<td></td>
            <td></td>
		</tr>
            
            </form>
            
			
		</tbody>
		</table>	 
			
           
            
		</div>

		</div>
        
				
	</div>
	<?php endif;?>
  